#ifndef MPHTTPDEFINES_H
#define MPHTTPDEFINES_H

#include <string>

/******************************
 *
 * 名称：      公共的枚举或结构体定义类
 * 作用范围：   公共的
 * 创建时间：   2022-10-03
 *
 ******************************/


namespace MP{
namespace HTTP{

enum HTTP_SEND_STATU_CODE
{
    OK = 0,
    Unkown = 1,                     //未知
    UnsetHost = 2,                  //请求中未设置HOST
    ErrTimeout = 3,                 //HTTP请求超时
    ErrResolve = 4,                 //DNS解析HOST失败
    ErrConnect = 5,                 //建立HTTP连接失败
    ErrWrite = 6,                   //Socket写入数据失败
    ErrRequestData = 7,             //Socket写入数据失败
    ErrInvalidResponse = 8,         //InvalidResponse
    ErrRead = 9,                    //Socket读取数据失败 response
    ErrConnection = 10 ,            //无法获取连接
    ErrNotHttp200 = 11              //响应状态非200或204
};

const char* HTTP_SEND_STATU_CODE_TOSTRING(HTTP_SEND_STATU_CODE c);

typedef struct SslSettings {

    SslSettings(){ }

    SslSettings(std::string _client_private_key_file,
                std::string _client_certificate_file,
                std::string _certificate_authority_bundle_file)
        : client_private_key_file(_client_private_key_file)
        , client_certificate_file(_client_certificate_file)
        , certificate_authority_bundle_file(_certificate_authority_bundle_file)
    {
    }

    std::string client_private_key_file;
    std::string client_certificate_file;
    std::string certificate_authority_bundle_file;

} SslSettings,*p_SslSettings;

typedef struct HttpFormData {
    HttpFormData(std::string n,
                 std::string v)
    {
        name= n;
        value = v;
    }

    //用于std::find函数进行查询
    //参考：https://blog.csdn.net/qq_34039018/article/details/100077763
    //     https://blog.csdn.net/qq_42695024/article/details/125406129
    bool operator == (const std::string & n){
        return (this->name == n);
    }

    std::string name;
    std::string value;

} HttpFormData,*p_HttpFormData;

typedef struct HttpFormFile {

    HttpFormFile(std::string n,
                 std::string f,
                 std::string p)
    {
        name= n;
        fileName = f;
        filePath = p;
    }

    //用于std::find函数进行查询
    //参考：https://blog.csdn.net/qq_34039018/article/details/100077763
    //     https://blog.csdn.net/qq_42695024/article/details/125406129
    bool operator == (const std::string & n){
        return (this->name == n);
    }

    std::string name;
    std::string fileName;
    std::string filePath;

} HttpFormFile,*p_HttpFormFile;


}   //HTTP
}   //MP

#endif // MPHTTPDEFINES_H
